Optimal. Leaf size=221 \[ -\frac {i \tanh ^{-1}\left (\frac {\sqrt {c+d \tan (e+f x)}}{\sqrt {c-i d}}\right )}{4 a^2 \sqrt {c-i d} f}+\frac {\left (2 i c^2-6 c d-7 i d^2\right ) \tanh ^{-1}\left (\frac {\sqrt {c+d \tan (e+f x)}}{\sqrt {c+i d}}\right )}{8 a^2 (c+i d)^{5/2} f}+\frac {(2 i c-5 d) \sqrt {c+d \tan (e+f x)}}{8 a^2 (c+i d)^2 f (1+i \tan (e+f x))}-\frac {\sqrt {c+d \tan (e+f x)}}{4 (i c-d) f (a+i a \tan (e+f x))^2} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.42, antiderivative size = 221, normalized size of antiderivative = 1.00, number of steps
used = 9, number of rules used = 6, integrand size = 30, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {3640, 3677,
3620, 3618, 65, 214} \begin {gather*} \frac {\left (2 i c^2-6 c d-7 i d^2\right ) \tanh ^{-1}\left (\frac {\sqrt {c+d \tan (e+f x)}}{\sqrt {c+i d}}\right )}{8 a^2 f (c+i d)^{5/2}}+\frac {(-5 d+2 i c) \sqrt {c+d \tan (e+f x)}}{8 a^2 f (c+i d)^2 (1+i \tan (e+f x))}-\frac {i \tanh ^{-1}\left (\frac {\sqrt {c+d \tan (e+f x)}}{\sqrt {c-i d}}\right )}{4 a^2 f \sqrt {c-i d}}-\frac {\sqrt {c+d \tan (e+f x)}}{4 f (-d+i c) (a+i a \tan (e+f x))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 65
Rule 214
Rule 3618
Rule 3620
Rule 3640
Rule 3677
Rubi steps
\begin {align*} \int \frac {1}{(a+i a \tan (e+f x))^2 \sqrt {c+d \tan (e+f x)}} \, dx &=-\frac {\sqrt {c+d \tan (e+f x)}}{4 (i c-d) f (a+i a \tan (e+f x))^2}-\frac {\int \frac {-\frac {1}{2} a (4 i c-7 d)-\frac {3}{2} i a d \tan (e+f x)}{(a+i a \tan (e+f x)) \sqrt {c+d \tan (e+f x)}} \, dx}{4 a^2 (i c-d)}\\ &=\frac {(2 i c-5 d) \sqrt {c+d \tan (e+f x)}}{8 a^2 (c+i d)^2 f (1+i \tan (e+f x))}-\frac {\sqrt {c+d \tan (e+f x)}}{4 (i c-d) f (a+i a \tan (e+f x))^2}-\frac {\int \frac {-\frac {1}{2} a^2 \left (4 c^2+10 i c d-9 d^2\right )-\frac {1}{2} a^2 (2 c+5 i d) d \tan (e+f x)}{\sqrt {c+d \tan (e+f x)}} \, dx}{8 a^4 (c+i d)^2}\\ &=\frac {(2 i c-5 d) \sqrt {c+d \tan (e+f x)}}{8 a^2 (c+i d)^2 f (1+i \tan (e+f x))}-\frac {\sqrt {c+d \tan (e+f x)}}{4 (i c-d) f (a+i a \tan (e+f x))^2}+\frac {\int \frac {1+i \tan (e+f x)}{\sqrt {c+d \tan (e+f x)}} \, dx}{8 a^2}+\frac {\left (2 c^2+6 i c d-7 d^2\right ) \int \frac {1-i \tan (e+f x)}{\sqrt {c+d \tan (e+f x)}} \, dx}{16 a^2 (c+i d)^2}\\ &=\frac {(2 i c-5 d) \sqrt {c+d \tan (e+f x)}}{8 a^2 (c+i d)^2 f (1+i \tan (e+f x))}-\frac {\sqrt {c+d \tan (e+f x)}}{4 (i c-d) f (a+i a \tan (e+f x))^2}+\frac {i \text {Subst}\left (\int \frac {1}{(-1+x) \sqrt {c-i d x}} \, dx,x,i \tan (e+f x)\right )}{8 a^2 f}-\frac {\left (i \left (2 c^2+6 i c d-7 d^2\right )\right ) \text {Subst}\left (\int \frac {1}{(-1+x) \sqrt {c+i d x}} \, dx,x,-i \tan (e+f x)\right )}{16 a^2 (c+i d)^2 f}\\ &=\frac {(2 i c-5 d) \sqrt {c+d \tan (e+f x)}}{8 a^2 (c+i d)^2 f (1+i \tan (e+f x))}-\frac {\sqrt {c+d \tan (e+f x)}}{4 (i c-d) f (a+i a \tan (e+f x))^2}-\frac {\text {Subst}\left (\int \frac {1}{-1-\frac {i c}{d}+\frac {i x^2}{d}} \, dx,x,\sqrt {c+d \tan (e+f x)}\right )}{4 a^2 d f}-\frac {\left (2 c^2+6 i c d-7 d^2\right ) \text {Subst}\left (\int \frac {1}{-1+\frac {i c}{d}-\frac {i x^2}{d}} \, dx,x,\sqrt {c+d \tan (e+f x)}\right )}{8 a^2 (c+i d)^2 d f}\\ &=-\frac {i \tanh ^{-1}\left (\frac {\sqrt {c+d \tan (e+f x)}}{\sqrt {c-i d}}\right )}{4 a^2 \sqrt {c-i d} f}-\frac {\left (6 c d-i \left (2 c^2-7 d^2\right )\right ) \tanh ^{-1}\left (\frac {\sqrt {c+d \tan (e+f x)}}{\sqrt {c+i d}}\right )}{8 a^2 (c+i d)^{5/2} f}+\frac {(2 i c-5 d) \sqrt {c+d \tan (e+f x)}}{8 a^2 (c+i d)^2 f (1+i \tan (e+f x))}-\frac {\sqrt {c+d \tan (e+f x)}}{4 (i c-d) f (a+i a \tan (e+f x))^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 2.24, size = 275, normalized size = 1.24 \begin {gather*} \frac {\sec ^2(e+f x) (\cos (f x)+i \sin (f x))^2 \left (\frac {2 \left (\sqrt {-c+i d} \left (-2 i c^2+6 c d+7 i d^2\right ) \text {ArcTan}\left (\frac {\sqrt {c+d \tan (e+f x)}}{\sqrt {-c-i d}}\right )+2 i (-c-i d)^{5/2} \text {ArcTan}\left (\frac {\sqrt {c+d \tan (e+f x)}}{\sqrt {-c+i d}}\right )\right ) (\cos (2 e)+i \sin (2 e))}{(-c-i d)^{5/2} \sqrt {-c+i d}}+\frac {2 \cos (e+f x) (i \cos (2 f x)+\sin (2 f x)) ((4 c+7 i d) \cos (e+f x)+(2 i c-5 d) \sin (e+f x)) \sqrt {c+d \tan (e+f x)}}{(c+i d)^2}\right )}{16 f (a+i a \tan (e+f x))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.35, size = 232, normalized size = 1.05
method | result | size |
derivativedivides | \(\frac {2 d^{3} \left (\frac {i \arctan \left (\frac {\sqrt {c +d \tan \left (f x +e \right )}}{\sqrt {i d -c}}\right )}{8 d^{3} \sqrt {i d -c}}+\frac {\frac {\frac {d \left (5 i d +2 c \right ) \left (c +d \tan \left (f x +e \right )\right )^{\frac {3}{2}}}{4 i c d +2 c^{2}-2 d^{2}}-\frac {d \left (9 i c d +2 c^{2}-7 d^{2}\right ) \sqrt {c +d \tan \left (f x +e \right )}}{2 \left (2 i c d +c^{2}-d^{2}\right )}}{\left (-d \tan \left (f x +e \right )+i d \right )^{2}}-\frac {\left (2 i c^{2}-7 i d^{2}-6 c d \right ) \arctan \left (\frac {\sqrt {c +d \tan \left (f x +e \right )}}{\sqrt {-i d -c}}\right )}{2 \left (2 i c d +c^{2}-d^{2}\right ) \sqrt {-i d -c}}}{8 d^{3}}\right )}{f \,a^{2}}\) | \(232\) |
default | \(\frac {2 d^{3} \left (\frac {i \arctan \left (\frac {\sqrt {c +d \tan \left (f x +e \right )}}{\sqrt {i d -c}}\right )}{8 d^{3} \sqrt {i d -c}}+\frac {\frac {\frac {d \left (5 i d +2 c \right ) \left (c +d \tan \left (f x +e \right )\right )^{\frac {3}{2}}}{4 i c d +2 c^{2}-2 d^{2}}-\frac {d \left (9 i c d +2 c^{2}-7 d^{2}\right ) \sqrt {c +d \tan \left (f x +e \right )}}{2 \left (2 i c d +c^{2}-d^{2}\right )}}{\left (-d \tan \left (f x +e \right )+i d \right )^{2}}-\frac {\left (2 i c^{2}-7 i d^{2}-6 c d \right ) \arctan \left (\frac {\sqrt {c +d \tan \left (f x +e \right )}}{\sqrt {-i d -c}}\right )}{2 \left (2 i c d +c^{2}-d^{2}\right ) \sqrt {-i d -c}}}{8 d^{3}}\right )}{f \,a^{2}}\) | \(232\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 1429 vs. \(2 (179) = 358\).
time = 1.57, size = 1429, normalized size = 6.47 \begin {gather*} -\frac {{\left (8 \, {\left (a^{2} c^{2} + 2 i \, a^{2} c d - a^{2} d^{2}\right )} f \sqrt {\frac {i}{16 \, {\left (-i \, a^{4} c - a^{4} d\right )} f^{2}}} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (-2 \, {\left (4 \, {\left ({\left (i \, a^{2} c + a^{2} d\right )} f e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (i \, a^{2} c + a^{2} d\right )} f\right )} \sqrt {\frac {{\left (c - i \, d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + c + i \, d}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}} \sqrt {\frac {i}{16 \, {\left (-i \, a^{4} c - a^{4} d\right )} f^{2}}} - {\left (c - i \, d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} - c\right )} e^{\left (-2 i \, f x - 2 i \, e\right )}\right ) - 8 \, {\left (a^{2} c^{2} + 2 i \, a^{2} c d - a^{2} d^{2}\right )} f \sqrt {\frac {i}{16 \, {\left (-i \, a^{4} c - a^{4} d\right )} f^{2}}} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (-2 \, {\left (4 \, {\left ({\left (-i \, a^{2} c - a^{2} d\right )} f e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (-i \, a^{2} c - a^{2} d\right )} f\right )} \sqrt {\frac {{\left (c - i \, d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + c + i \, d}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}} \sqrt {\frac {i}{16 \, {\left (-i \, a^{4} c - a^{4} d\right )} f^{2}}} - {\left (c - i \, d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} - c\right )} e^{\left (-2 i \, f x - 2 i \, e\right )}\right ) + {\left (a^{2} c^{2} + 2 i \, a^{2} c d - a^{2} d^{2}\right )} f \sqrt {-\frac {4 i \, c^{4} - 24 \, c^{3} d - 64 i \, c^{2} d^{2} + 84 \, c d^{3} + 49 i \, d^{4}}{{\left (i \, a^{4} c^{5} - 5 \, a^{4} c^{4} d - 10 i \, a^{4} c^{3} d^{2} + 10 \, a^{4} c^{2} d^{3} + 5 i \, a^{4} c d^{4} - a^{4} d^{5}\right )} f^{2}}} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (\frac {{\left (2 \, c^{3} + 8 i \, c^{2} d - 13 \, c d^{2} - 7 i \, d^{3} + {\left ({\left (i \, a^{2} c^{3} - 3 \, a^{2} c^{2} d - 3 i \, a^{2} c d^{2} + a^{2} d^{3}\right )} f e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (i \, a^{2} c^{3} - 3 \, a^{2} c^{2} d - 3 i \, a^{2} c d^{2} + a^{2} d^{3}\right )} f\right )} \sqrt {\frac {{\left (c - i \, d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + c + i \, d}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}} \sqrt {-\frac {4 i \, c^{4} - 24 \, c^{3} d - 64 i \, c^{2} d^{2} + 84 \, c d^{3} + 49 i \, d^{4}}{{\left (i \, a^{4} c^{5} - 5 \, a^{4} c^{4} d - 10 i \, a^{4} c^{3} d^{2} + 10 \, a^{4} c^{2} d^{3} + 5 i \, a^{4} c d^{4} - a^{4} d^{5}\right )} f^{2}}} + {\left (2 \, c^{3} + 6 i \, c^{2} d - 7 \, c d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} e^{\left (-2 i \, f x - 2 i \, e\right )}}{8 \, {\left (-i \, a^{2} c^{3} + 3 \, a^{2} c^{2} d + 3 i \, a^{2} c d^{2} - a^{2} d^{3}\right )} f}\right ) - {\left (a^{2} c^{2} + 2 i \, a^{2} c d - a^{2} d^{2}\right )} f \sqrt {-\frac {4 i \, c^{4} - 24 \, c^{3} d - 64 i \, c^{2} d^{2} + 84 \, c d^{3} + 49 i \, d^{4}}{{\left (i \, a^{4} c^{5} - 5 \, a^{4} c^{4} d - 10 i \, a^{4} c^{3} d^{2} + 10 \, a^{4} c^{2} d^{3} + 5 i \, a^{4} c d^{4} - a^{4} d^{5}\right )} f^{2}}} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (\frac {{\left (2 \, c^{3} + 8 i \, c^{2} d - 13 \, c d^{2} - 7 i \, d^{3} + {\left ({\left (-i \, a^{2} c^{3} + 3 \, a^{2} c^{2} d + 3 i \, a^{2} c d^{2} - a^{2} d^{3}\right )} f e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (-i \, a^{2} c^{3} + 3 \, a^{2} c^{2} d + 3 i \, a^{2} c d^{2} - a^{2} d^{3}\right )} f\right )} \sqrt {\frac {{\left (c - i \, d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + c + i \, d}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}} \sqrt {-\frac {4 i \, c^{4} - 24 \, c^{3} d - 64 i \, c^{2} d^{2} + 84 \, c d^{3} + 49 i \, d^{4}}{{\left (i \, a^{4} c^{5} - 5 \, a^{4} c^{4} d - 10 i \, a^{4} c^{3} d^{2} + 10 \, a^{4} c^{2} d^{3} + 5 i \, a^{4} c d^{4} - a^{4} d^{5}\right )} f^{2}}} + {\left (2 \, c^{3} + 6 i \, c^{2} d - 7 \, c d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} e^{\left (-2 i \, f x - 2 i \, e\right )}}{8 \, {\left (-i \, a^{2} c^{3} + 3 \, a^{2} c^{2} d + 3 i \, a^{2} c d^{2} - a^{2} d^{3}\right )} f}\right ) - 2 \, {\left (3 \, {\left (i \, c - 2 \, d\right )} e^{\left (4 i \, f x + 4 i \, e\right )} - {\left (-4 i \, c + 7 \, d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + i \, c - d\right )} \sqrt {\frac {{\left (c - i \, d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + c + i \, d}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}}\right )} e^{\left (-4 i \, f x - 4 i \, e\right )}}{32 \, {\left (a^{2} c^{2} + 2 i \, a^{2} c d - a^{2} d^{2}\right )} f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} - \frac {\int \frac {1}{\sqrt {c + d \tan {\left (e + f x \right )}} \tan ^{2}{\left (e + f x \right )} - 2 i \sqrt {c + d \tan {\left (e + f x \right )}} \tan {\left (e + f x \right )} - \sqrt {c + d \tan {\left (e + f x \right )}}}\, dx}{a^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 494 vs. \(2 (179) = 358\).
time = 0.64, size = 494, normalized size = 2.24 \begin {gather*} -\frac {2 \, {\left (2 \, c^{2} + 6 i \, c d - 7 \, d^{2}\right )} \arctan \left (\frac {2 \, {\left (\sqrt {d \tan \left (f x + e\right ) + c} c - \sqrt {c^{2} + d^{2}} \sqrt {d \tan \left (f x + e\right ) + c}\right )}}{c \sqrt {-2 \, c + 2 \, \sqrt {c^{2} + d^{2}}} + i \, \sqrt {-2 \, c + 2 \, \sqrt {c^{2} + d^{2}}} d - \sqrt {c^{2} + d^{2}} \sqrt {-2 \, c + 2 \, \sqrt {c^{2} + d^{2}}}}\right )}{-8 \, {\left (i \, a^{2} c^{2} f - 2 \, a^{2} c d f - i \, a^{2} d^{2} f\right )} \sqrt {-2 \, c + 2 \, \sqrt {c^{2} + d^{2}}} {\left (\frac {i \, d}{c - \sqrt {c^{2} + d^{2}}} + 1\right )}} + \frac {2 \, {\left (d \tan \left (f x + e\right ) + c\right )}^{\frac {3}{2}} c d - 2 \, \sqrt {d \tan \left (f x + e\right ) + c} c^{2} d + 5 i \, {\left (d \tan \left (f x + e\right ) + c\right )}^{\frac {3}{2}} d^{2} - 9 i \, \sqrt {d \tan \left (f x + e\right ) + c} c d^{2} + 7 \, \sqrt {d \tan \left (f x + e\right ) + c} d^{3}}{8 \, {\left (a^{2} c^{2} f + 2 i \, a^{2} c d f - a^{2} d^{2} f\right )} {\left (d \tan \left (f x + e\right ) - i \, d\right )}^{2}} - \frac {\arctan \left (-\frac {2 \, {\left (-i \, \sqrt {d \tan \left (f x + e\right ) + c} c - i \, \sqrt {c^{2} + d^{2}} \sqrt {d \tan \left (f x + e\right ) + c}\right )}}{\sqrt {2 \, c + 2 \, \sqrt {c^{2} + d^{2}}} c - i \, \sqrt {2 \, c + 2 \, \sqrt {c^{2} + d^{2}}} d + \sqrt {c^{2} + d^{2}} \sqrt {2 \, c + 2 \, \sqrt {c^{2} + d^{2}}}}\right )}{2 \, a^{2} \sqrt {2 \, c + 2 \, \sqrt {c^{2} + d^{2}}} f {\left (-\frac {i \, d}{c + \sqrt {c^{2} + d^{2}}} + 1\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 9.17, size = 2500, normalized size = 11.31 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________